<?php
$this->breadcrumbs = array(
	'凭证列表',
);

if (Yii::app()->user->checkAccess('accountTokenManage')) {
	$this->userActions = array(
		array(
			'label' => '新建凭证',
			'url' => array(
				'create'
			)
		),
		array(
			'label' => '管理凭证',
			'url' => array(
				'admin'
			)
		),
	);
}
?>

<h1>凭证列表</h1>
<div class="account-token-list">
<div class="form">
<?php $form = $this
	->beginWidget('CActiveForm',
		array(
			'action' => Yii::app()->createUrl($this->route),
			'method' => 'get',
		));
?>

<fieldset>
<legend>搜索条件</legend>
<div><label>项目</label><?php echo AccountTokenProject::getGlobalProjectName(); ?></div>
	<div class="span-7">
		<?php echo $form->label($searchModel, 'tokenYear'); ?>
		<?php echo $form
			->dropDownList($searchModel, 'tokenYear', AccountToken::findYears(),
				array(
					'empty' => '不限'
				));
		?>年
		<?php echo $form
			->dropDownList($searchModel, 'tokenMonth', array_combine(range(1, 12), range(1, 12)),
				array(
					'empty' => '不限'
				));
		?>月
	</div>
<div class="span-7">
		<?php echo $form->label($searchModel, 'categoryId'); ?>
		<?php
		$this
			->widget("widgets.accountTokenCategory.JAccountTokenCategorySelector",
				array(
					"model" => $searchModel,
					"attribute" => "categoryId",
				));
		?>
</div>
<div class="clear"></div>
	<div class="span-7">
		<?php echo $form->label($searchModel, 'numberMin'); ?>
		<?php echo $form->textField($searchModel, 'numberMin', array(
				'size' => 6
			));
		?> -
		<?php echo $form->textField($searchModel, 'numberMax', array(
				'size' => 6
			));
		?>
	</div>
	<div class="span-7">
		<?php echo $form->label($searchModel, 'summary'); ?>
		<?php echo $form->textField($searchModel, 'summary', array(
				'size' => 20
			));
		?>
	</div>
<div class="clear"></div>
	<div class="row">
		<?php echo $form->label($searchModel, 'printResult'); ?>
		<?php echo $form->checkBox($searchModel, 'printResult');
		?><span class="hint">若需要打印凭证，请选择。若不选择，则以简洁模式显示。</span>
	</div>
	<div class="row">
		<?php echo $form->label($searchModel, 'singlePage'); ?>
		<?php echo $form->checkBox($searchModel, 'singlePage');
		?><span class="hint">若要在一个页面内显示所有凭证以便打印，请选择。（可能会比较慢）</span>
	</div>
	<div class="row buttons">
		<?php echo CHtml::submitButton('搜索'); ?> <span class="hint">按 Ctrl+P 打印当前凭证</span>
	</div>

</fieldset>
<?php $this->endWidget(); ?>
</div>
<?php
$overallPage = new stdClass();
$overallPage->page = 0;

$this
	->widget('zii.widgets.CListView',
		array(
			'dataProvider' => $dataProvider,
			'itemView' => $searchModel->printResult ? '_view' : '_quickView',
			'viewData' => array(
				'overallPage' => $overallPage
			),
		));
?>
</div>
